<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ page import="com.gouwudai.gobbs.pojo.TbbsUserInfo"%>
<%@ include file="../common/common.jsp" %>
<%@ include file="user_pass2.jsp" %>
<%
int userId = ParamUtils.getIntParameter(request,"userId");

IUserService userService = (IUserService)BeanManager.getBean("userService");

TbbsUserInfo tbbsUserInfo = userService.load(userId);

String mailFrom = userLogin.getEmail();
String loginId = LOGIN_ID;
String userName = USER_NAME;
String mailTo = tbbsUserInfo.getEmail();
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=SYSTITLE%> - 在线发送Email</title>
<meta name="Keywords" content="<%=SYSMETAKEY%>" />
<meta name="Description" content="<%=SYSMETADESC%>" />
<%@ include file="../common/meta.inc" %>
<link rel="stylesheet" type="text/css" href="css/defaultStyle.css" >
<script language="javascript" src="${pageContext.request.contextPath}/scripts/prototype.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/buffalo/buffalo.js"></script>
</head>
<body>
<%@ include file="../common/waiting.inc" %>
<SCRIPT language="javascript">

setStatus('<%=SYSTITLE%> - 在线发送Email');

var END_POINT="${pageContext.request.contextPath}/buffalo";
var buffalo = new Buffalo(END_POINT);
function doSubmit()
{
	form = document.theform;
	if(!validateForm(form))
		return false;
		
    var obj = {};    
    
	obj[Buffalo.BOCLASS] = "java.util.HashMap";
	
	obj.mailFrom = "<%=mailFrom%>";
	obj.mailSign = "<%=userName%>(<%=loginId%>)";
	obj.mailTo = "<%=mailTo%>";
	obj.ttitle =  $F('ttitle');
	obj.tcontent =  $F('tcontent');	
	
    buffalo.remoteCall("emailServiceAjaxService.topicSend",[obj], function(reply) 
    {
        var ret = reply.getResult();
       	ajaxSubmit(ret,"邮件已发送！","close");        
    }); 
}

function validateForm(form)
{
	if(!sl_check(form.ttitle,"主题",100,1)) return false; 
	if(!sl_checkNull(form.tcontent,"内容")) return false; 
	return true;
}
</SCRIPT>
<DIV class="line"></DIV>
<DIV class="list_table_0"><%=HtmlConst.navMenuNoLink("在线发送Email")%></DIV>
<DIV class="line"></DIV>
<form name="theform" id="theform" method="post" onSubmit="return validateForm(this);">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tab">
<tr class="tab2">
<td width="100"><strong>收件人</strong></td>
<td height="22">
<%=tbbsUserInfo.getUserName()%>(<%=tbbsUserInfo.getEmail() %>)<br>
(如果用户注册Email地址不正确将无法收到您的邮件)
</td>
</tr>
<tr class="tab2">
<td height="25"><strong>回复地址</strong></td>
<td>
<span class="style1"><%=userLogin.getEmail()%></span>
<br>
如果您注册的Email有变动，请更新您的注册资料再来发送Email，否则网友（<%=tbbsUserInfo.getUserName()%>）可能无法正确回复您的邮件！
</td>
</tr>
<tr class="tab2">
<td height="12"><strong>主题</strong></td>
<td><input type="text" id="ttitle" name="ttitle" size="20"></td>
</tr>
<tr class="tab2">
<td height="12"><strong>内容</strong></td>
<td><textarea id="tcontent" name="tcontent" cols="60" rows="8"></textarea></td>
</tr>
<tr class="tab2">
<td height="25">&nbsp;</td>
<td>
<input name="btnSubmit" type="button" id="btnSubmit" value="确定" onClick="javascript:doSubmit();"/>
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" name="btnClose" value="取消"  onClick="javascript:self.close();"/></td>
</tr>
</table>
</form>
<%=COPYRIGHTFOOT%>
<%@ include file="../common/foot.inc"%>
</body>
</html>